package cn.adelyn.base.api.auth.feign;


import cn.adelyn.base.api.auth.pojo.bo.UserInfoInTokenBO;
import cn.adelyn.common.core.response.ServerResponseEntity;
import cn.adelyn.common.feign.config.FeignInsideAuthConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import jakarta.validation.constraints.NotBlank;

/**
 * @Author chengzelee
 * @Date 2022/11/27 16:39
 * @Desc token校验
 */
@Validated
@FeignClient(value = "adelyn-base-auth", contextId ="token", path = "/blog/auth")
public interface TokenFeignClient {

	/**
	 * 校验token并返回token保存的用户信息
	 */
	@PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/checkToken")
	ServerResponseEntity<UserInfoInTokenBO> checkToken(@RequestBody @NotBlank(message = "encryptedAccessToken 不能为空~") String encryptedAccessToken);

}
